package com.service.thirddatacenter.chiaexplorer.controller;

import com.service.core.rest.BaseController;
import com.service.core.rest.response.BaseResponse;
import com.service.thirddatacenter.chiaexplorer.client.ChiaExplorerClient;
import com.service.thirddatacenter.chiaexplorer.service.BlockChainRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("chia/explore/")
public class ChiaExploreController extends BaseController {


    @Autowired
    private ChiaExplorerClient chiaExplorerClient;

    @Autowired
    private BlockChainRecordService blockChainRecordService;

    @GetMapping("summary")
    public BaseResponse getSummary() {
        blockChainRecordService.createBlockChain();
        return successQueryOneResponse(chiaExplorerClient.getBlockchainSummary());
    }
}
